
import GoodsCartModel from "@/src/lib/models/goods_cart_model"
import { Text } from "@tarojs/components"
import { connect } from "react-redux"
import List from "./list"

interface GoodsInvalidListProps {
    models?: GoodsCartModel[],
    dispatch?: any
}

const GoodsInvalidList = (props: GoodsInvalidListProps) => {

    let onClearBtnClick = () => {
        const { dispatch } = props
        dispatch({
            type: "cart/clearInvalidGoods"
        })
    }

    let clearBtn = <Text style={{ fontSize: '26rpx', color: '#FF4C47'}} onClick={onClearBtnClick}>清空失效宝贝</Text>
    return (
        <List title="失效宝贝" titleRightEl={ clearBtn } models={ props.models } />
    )
}

export default connect(null, (dispatch) => ({dispatch}))(GoodsInvalidList)